Skip to content

Conversation

@danxuliu
Copy link
Member

Follow up to #6862

Since 48a74da offers are requested again and again in an endless loop for the peer of the SIP bridge. If the block that requests an offer when a negotiation is needed for a subscriber is moved into the if condition that checks that the ICE connection state is not new nor checking then only the original offer is requested and that is it.

My guess is that this is caused by the lack of data channels in the SIP bridge (but as mentioned it is just a guess, I do not know if the SIP bridge has data channels or not, and I can not test it either). If a publisher does not have data channels then Janus will not open data channels for its subscribers. However, when a subscriber is created the status data channel was always tried to be opened. As the offer sent by Janus for the SIP bridge subscriber does not have data channels opening them will trigger a negotiationneeded event. This will cause a new offer to be requested, but that offer will still not have data channels, so negotiationneeded will be triggered again, another offer will be requested, the offer will not have data channels... and so on.

Then, why does it work when moving the block inside the if condition? In that case opening the data channel will still trigger the negotiationneeded event. However, as it is done even before the offer was set the ICE connection state will be new, so it will not enter the if condition. That is, the subscriber is left forever in the negotiationneeded state, and as there are no further offers received for that subscriber the endless loop does not occur.

Due to all that this pull request prevents the SIP bridge subscriber from creating data channels. It also fixes another minor bug found while investigating that (trying to send data channels messages through the subscribers if there is no publisher peer).

@fancycode Could you test this pull request and confirm (or deny :-) ) my suspicions? Thanks!

When the HPB is used the data channel messages need to be sent through
the publisher peer. Due to a wrong condition if there was no publisher
peer they tried to be sent using the data channels of the subscribers,
but those messages were simply ignored.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
"enableDataChannels" prevented the messages to be sent when the data
channels were disabled, but it did not prevent the data channels from
being created.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The SIP bridge publisher does not have data channels, so they need to be
explicitly disabled in the subscriber. Otherwise it would try to open
them, which would cause an endless loop of renegotiations, as after a
negotiation the data channels will still not be opened, which will
trigger a negotiation again.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu
Copy link
Member Author

/backport to stable24

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the loop

Copy link
Member

@fancycode fancycode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed the SIP bridge doesn't create datachannels, so this could have been the problem.

👍 I can no longer reproduce the loop with this change.

@nickvergessen nickvergessen merged commit 88d32ad into master May 3, 2022
@nickvergessen nickvergessen deleted the fix-endless-offer-requests-with-the-sip-bridge branch May 3, 2022 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants